package com.example.demo1;

import com.example.demo1.service.TurnstileStateMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = "com.example")
public class Demo1Application implements CommandLineRunner {

    @Autowired
    private TurnstileStateMachineService turnstileStateMachineService;

    public static void main(String[] args) {
        SpringApplication.run(Demo1Application.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        //turnstileStateMachineService.init();
        System.out.println("获取初始状态:" + turnstileStateMachineService.getCurrentState());
        turnstileStateMachineService.doPay();
        turnstileStateMachineService.doPush();
        System.out.println("测试结束");
    }
}
